#ifndef _WEBRTC_ADAPT_INCLUDE_
#define _WEBRTC_ADAPT_INCLUDE_

#include <stdint.h>

/*
 *  webrtc adapt support
 *  
 *  channel: 1
 *  sample rate: 8000Hz, 16000Hz
 *  sample frame size: 10ms, 20ms
 */

#ifdef __cplusplus
extern "C" {
#endif

/* ---------- vad ---------- */
void* webrtcadapt_vad_open(int32_t samplerate);
void webrtcadapt_vad_close(void* handle);
/*
 *  return:
 *      -1 : error
 *       0 : non-active voice
 *       1 : active voice
 */
int32_t webrtcadapt_vad_process(void* handle, uint8_t* frame, int32_t framesize);


/* ---------- agc ---------- */
void* webrtcadapt_agc_open(int32_t samplerate);
void webrtcadapt_agc_close(void* handle);
/* default: 9 dB */
int32_t webrtcadapt_agc_getgain(void* handle);
void webrtcadapt_agc_setgain(void* handle, int32_t gain);
/* return: 0: success */
int32_t webrtcadapt_agc_process(void* handle, uint8_t* frame, int32_t framesize);


/* ---------- aec ---------- */
void* webrtcadapt_aec_open(int32_t samplerate);
void webrtcadapt_aec_close(void* handle);
/* return: 0: success */
int32_t webrtcadapt_aec_process(
    void* handle, uint8_t* frame, int32_t framesize, int32_t delayms);


#ifdef __cplusplus
}
#endif

#endif // _WEBRTC_ADAPT_INCLUDE_
